package com.wellink.viewflipperdemo;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ViewFlipper;

public class MainActivity extends AppCompatActivity {

    ViewFlipper flipper;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        flipper = findViewById(R.id.details);
    }

    public void doPrev(View source){
        flipper.setInAnimation(this,R.anim.slide_in_right);
        flipper.setOutAnimation(this,R.anim.slide_out_left);
        flipper.showPrevious();
        flipper.stopFlipping();
    }

    public void doNext(View source){
        flipper.setInAnimation(this,android.R.anim.slide_in_left);
        flipper.setOutAnimation(this,android.R.anim.slide_out_right);
        flipper.showNext();
        flipper.stopFlipping();
    }

    public void doAuto(View source){
        flipper.setInAnimation(this,android.R.anim.slide_in_left);
        flipper.setOutAnimation(this,android.R.anim.slide_out_right);
        flipper.startFlipping();
    }
}
